package top.superflow.lang


class SEnum (rawValue : String){
  if(StringUtils.isBlank(rawValue)){
    throw new IllegalArgumentException("The raw value should not be null, it's used to identify the type")
  }
  
  protected val key: String = rawValue
  
  override def toString : String = {
    this.key
  }
  
  
  override def equals(obj : Any) : Boolean = {
    if(obj == null){
      return false
    }
    
    if(this.getClass != obj.getClass){
      return false
    }
    
    return this.key.equals(obj.toString)
  }
  
  override def hashCode : Int =  {
    this.key.hashCode()
  }
}


private class TestEnum1(abc : String) extends SEnum(abc : String){}

private class TestEnum2(abc : String) extends TestEnum1(abc : String){}

object SEnum{
  def main(args: Array[String]): Unit = {
    print(new TestEnum1("abc").getClass == new TestEnum1("abc").getClass)
  }
}